home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Light ROM 4
/
Light ROM 4 - Disc 1.iso
/
text
/
maillist
/
1995
/
1095.doc
/
001587_owner-lightwav…mail.webcom.com_Sun Oct 29 12:02:59 1995.msg
< prev
next >
Wrap
Internet Message Format
|
1995-11-07
|
8KB
Received: by mail.webcom.com
(1.37.109.15/16.2) id AA118306979; Sun, 29 Oct 1995 12:02:59 -0800
Return-Path: <owner-lightwave@mail.webcom.com>
Received: from netcom15.netcom.com by mail.webcom.com with ESMTP
(1.37.109.15/16.2) id AA118246975; Sun, 29 Oct 1995 12:02:55 -0800
Received: by netcom15.netcom.com (8.6.12/Netcom)
id LAA06722; Sun, 29 Oct 1995 11:54:38 -0800
From: bhood@netcom.com (robert hood)
Message-Id: <199510291954.LAA06722@netcom15.netcom.com>
Subject: Batch Rendering ala BML!
To: lightwave@mail.webcom.com
Date: Sun, 29 Oct 1995 11:54:38 -0800 (PST)
Cc: lwplugin-l@netcom.com
X-Mailer: ELM [version 2.4 PL23]
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Content-Length: 7065
Sender: owner-lightwave@mail.webcom.com
Precedence: bulk
Here is a BML script (long) that batch renders one or more scene files using
ScreamerNet II. Sorry for the length. =|^)
------------------------------------------------------------------------------
// BATCH.BML
//
// An interface script to batch scene rendering with ScreamerNet II. This is
// not intended to be use by a render farm as it currently exists, but rather
// as a demonstration.
//
// It expects a text file to reside in the root directory called "batch.txt"
// that contains one line for each scene to be rendered, in the following
// format:
//
// <scene file name> <first frame> <last frame> [<RGB name> [<Alpha name>]]
//
// for example,
//
// \lw\atom\atom.lws 1 3 \atom
// \lw\curtain\curtain.lws 1 1 \curt
//
// It also manually invokes ScreamerNet on the local machine. In the real
// world, SNII would already be running on one or more machines, and the
// script would only have to interface with the SNII job/reply files.
//
// (this script actually works, by the way. =|^)
// we must specify 'asyncspawn' so that SNII runs in parallel with us
#pragma asyncspawn
// these variables must be global because they could potentially be
// referenced by the ONERROR handler below
var commandFile,replyFile;
var batchFile,snID;
var tmp = getenv("TMP");
main
{
var batchItems[5];
var commandName = string(tmp,"\snii.job");
var str;
var timeout;
batchItems[] = nil; // initialize the array
filedelete(commandName);
filedelete(tmp,"\snii.rpl");
commandFile = file(commandName,"w");
if(commandFile == nil)
{
error("Cannot create ScreamerNet job file");
return;
}
commandFile.writeln("init");
commandFile.close();
str = string(tmp,"\snii.rpl");
replyFile = file(str,"w");
replyFile.close();
replyFile.open(str,"r");
if(replyFile.isOpen() == false)
{
error("Cannot create ScreamerNet reply file");
filedelete(tmp,"\snii.job");
return;
}
// now open the batch file
batchFile = file("\batch.txt","r");
if(batchFile == nil)
{
error("Cannot open batch file");
replyFile.close();
filedelete(tmp,"\snii.job");
filedelete(tmp,"\snii.rpl");
return;
}
// ideally, ScreamerNet would already be running on one or
// more machines. we'll run it locally just for purposes of
// making this script work.
snID = spawn("\windows\apps\newtek\programs\lwsn -2 ",
tmp,"\snii.job ",
tmp,"\snii.rpl");
if(snID == nil)
{
error("Cannot create ScreamerNet process");
replyFile.close();
filedelete(tmp,"\snii.job");
filedelete(tmp,"\snii.rpl");
return;
}
// Ok, ScreamerNet II is running in parallel with us, watching
// 'snii.job' for commands. We will watch 'snii.rpl' for its replies
timeout = 6;
replyFile.rewind();
while(replyFile.read() != "Initializing" && timeout)
{
sleep(10); // sleep for 10 seconds
--timeout;
}
if(timeout == 0)
{
error("Communication error with ScreamerNet process");
replyFile.close();
filedelete(tmp,"\snii.job");
filedelete(tmp,"\snii.rpl");
return;
}
moninit(batchFile.lines() + 1,"Rendering scenes...");
monstep(); // try to get the monitor dialog up sooner
batchItems = batchFile.parse(" ");
while(batchFile.eof() == false)
{
commandFile.open(commandName,"w");
commandFile.writeln("load ",batchItems[1]);
commandFile.close();
sleep(2); // sleep for 2 seconds
replyFile.rewind();
if(replyFile.read() != "Loading")
{
error("Communication error with ScreamerNet process");
replyFile.close();
batchFile.close();
filedelete(tmp,"\snii.job");
filedelete(tmp,"\snii.rpl");
terminate(snID); // kill ScreamerNet
return;
}
// issue the SN "output" command if parameters have been specified
if(batchItems[4] != nil)
{
commandFile.open(commandName,"w");
// is the Alpha channel indicated also?
if(batchItems[5] != nil)
commandFile.writeln("output ",batchItems[4]," ",batchItems[5]);
else
commandFile.writeln("output ",batchItems[4]," (none)");
commandFile.close();
timeout = 6; // wait up to 30 seconds
replyFile.rewind();
while(replyFile.read() != "Setting output file options" && timeout)
{
sleep(5); // sleep 5 seconds
--timeout;
replyFile.rewind();
}
}
commandFile.open(commandName,"w");
commandFile.writeln("render ",batchItems[2]," ",batchItems[3]," 1");
commandFile.close();
sleep(5); // give it a chance to pick up the command
// Excuse me, but why can't SNII tell us when it is finished
// rendering?
commandFile.open(commandName,"w");
commandFile.writeln("init");
commandFile.close();
replyFile.rewind();
while(replyFile.read() != "Initializing")
{
sleep(60); // sleep 1 minute
replyFile.rewind();
}
if(monstep())
break;
batchItems = batchFile.parse(" ");
}
monend();
terminate(snID); // shut down ScreamerNet
replyFile.close();
batchFile.close();
filedelete(commandName);
filedelete(tmp,"\snii.rpl");
}
// cleanup handler -- we need this because BML is not aware
// of processes spawned by it's scripts
// ONERROR is an automatic function invoked by BML, if it
// is defined, when run-time errors occur. Run-time errors
// such as accessing uninitialized variables and the like that
// the programmer introduces. If 'autoerror' is specified,
// then command/function errors will also invoke this function.
ONERROR
{
commandFile.close();
replyFile.close();
batchFile.close();
filedelete(tmp,"\snii.job");
filedelete(tmp,"\snii.rpl");
terminate(snID); // shut down ScreamerNet
}
------------------------------------------------------------------------------
Render me gone, |||
Bob ^(===)^
-------------------------oOO--(_)--OOo--------------------------------------
Bob Hood | Bureaucracy destroys initiative. There is little that
| bureaucrats hate more than innovation, especially
Work: 303-730-1324 | innovation that produces better results than the old
Home: 303-980-8392 | routines. Improvements always make those at the top
bhood@netcom.com | of the heap look inept. Who enjoys appearing inept?
hood@cqgrd.com | - Frank Herbert
----------------------------------------------------------------------------
--
bhood@netcom.com (robert hood) sent this message.
To Post a Message : lightwave@webcom.com
Un/Subscription Requests To : lightwave-request@webcom.com
(DIGEST) or : lightwave-digest-request@webcom.com
Administrative Items To : owner-lightwave@webcom.com